home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Computers
/
Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso
/
shareware
/
fractals
/
cloud
/
cloud.doc
< prev
next >
Wrap
Text File
|
1994-11-17
|
16KB
|
419 lines
Cloud
"Cloud" is a program that generates and displays fractal surfaces.
I had briefly looked at 'sc', but found that it was too slow to
be interesting. I read about generating fractal surfaces and
displaying them as clouds in the (technical) book "Fractals", by
Jens Feder (ISBN 0-306-42851-2), section 13.4 "Random Addition
Surfaces". So I thought I'd try it myself. What follows are
some explanations of the program's user interface, and some of
its workings. The clouds that look like these images are called
"fracto-cumulus" by the way.
Requirements: It requires about 200K to run - I've tried it on an
A1000 with expansion memory turned off, and it works OK.
Cloud brings up a custom lo-res screen (320x200). The screen is in two
sections - the right 3/4 is where the image is displayed. On the left of
the screen is a control panel with a bunch of gadgets. Most of these gadgets
are grouped into three little panels. From the top of the window downwards,
these buttons are:
Standard Window Close Gadget:
Exit Cloud by clicking on the window's close gadget.
Auto - toggle to select the automatic generate and display loop.
When "auto" is set, the program will loop between generating
new images and displaying them. To stop, toggle "auto" back
off. To pause, toggle "pause".
Pause - toggle to pause while in the automatic loop.
This pauses the program while in the automatic loop.
You can then select other palettes.
Save - this will let you save the current image as an IFF file,
when it is implemented.
' ' - (there is an empty, unused gadget beneath Save)
Rand - toggle to turn on the randomizer.
This enables a section of code that adjusts the random
number generator. If you don't turn this on, you will
get the same sequence of images each time you run Cloud.
Scroll - toggle to have the display scroll up from the bottom.
When this is off, the new image fills in from the top
of the screen downwards. When it is on, the screen is
scrolled upwards, with the old image disappearing off the
top, and the new image appearing on the bottom. It adds
"lightning" to the clouds.
Gen - to generate and display a new image.
This generates a new image, and displays it.
Re-Do - to re-display the present image.
This displays the current image again, which is useful to
see the effects the different scalings can have on the
same image.
"d = XX %" - place to enter the delta percent value.
This string gadget accepts a two digit number whose value
is used in generating new images. The gadget hit box
surrounds the digits. The value determines the smoothness
of the image. For clouds, a good value is 80%, for terrain
and water, 70% is better. Lower and higher values are also
interesting, if less natural.
Log - selects a logarithmic scaling,
Lin - selects a linear scaling,
Exp - selects an exponential scaling,
Histo - selects an equal area scaling between data and colors.
You choose one of these four buttons to select the type
of scaling performed to map the image data to the screen.
There's more on this later.
Color Bar - shows the current image palette.
This isn't a gadget, it just shows you what the palette is.
Reverse - flips the color palette end for end.
By flipping the palette over, the image seems to reverse;
dark things become light, and light sections become dark.
Atmos - selects the "cloud in the sky" color palette,
Earth - selects the Rand McNally map palette,
Water - selects an "islands in oceans" palette,
Therm - selects a palette that is reminiscient of thermal images.
Choose one of these four buttons to select the color palette
for displaying the image. These are active at all times,
so that while generating the next image, you can fiddle with
the one currently on the screen.
-------------------------------------------------
About the color palettes (or do you say palette?):
The following table lists the color trends in each of the palettes.
Color range Atmos Earth Water Therm
----- ----- ----- -----
HI white near white light green red
^ ... dark brown sand orange
| lighter blue light brown blue-green yellow
| ... green light blue green
v lighter blue sand blue blue
LO blue lake blue deep blue dark blue
Data means: density height depth temperature
If you're running Workbench 1.3, you can use the Palette command to change
Cloud's colors. Put the Cloud screen in the front, pull it down to expose
a CLI window or the drawer containing the "Palette" command, and invoke
"Palette". You can then change Cloud's colors temporarily - the color changes
are not remembered by Cloud. Also, there will be a white rectangle left over
from where the Palette window was. Just click on the Re-Do gadget to redraw
the image.
-----------------------------
About the scaling selections:
The data can be mapped to the colors in many ways - I've chosen 4: linear,
log, exponential, and equal area. Each has its own good and bad points.
The linear scaling makes a hazy cloud, but it leaves the Earth landscape
flat and boring. This is because the majority of the data values get
mapped to the middle range of the palette - so we don't see much of the
peaks and pits.
The log scaling tends to expand the lower data values over a larger color
range and compress the higher values into the higher colors. It emphasizes
the upper data values at the expense of the lower ones. It makes the sky
seem even more hazy.
Exponential scaling is the reverse of log scaling. The higher data values
will be spread across a greater color range, as compared with linear scaling,
and the lower data values will be compressed into the lowest color(s). It
emphasizes the lower data values at the expense of the upper ones. The sky
becomes more blue with this setting.
The equal-area scaling uses a histogram to find out the distribution of the
data values. It then maps the data values to colors such that each color
occurs as often as every other color. It seems to reveal lots of detail,
and so it makes Therm and Water busy looking, but it makes Atmos look better.
It emphasizes the extremes of the data, both upper and lower, at the expense
of the mid-range values. The sky looks most natural with this setting -
patches of blue sky and patches of white clouds with quick transitions between.
-----------------------------
About the scaling algorithms:
LINEAR scaling maps the data values to palette color positions (pen numbers)
with the equation:
Delta-C
C = (V - VMin) * ------- + LoColor
Delta-V
This divides the range VMin to VMax into NColor sections (where NColor =
HiColor - LoColor + 1). Actually, instead of doing that equation over
66000 times, I build a color lookup table, from the minimum data value to
the maximum data value, and use that equation NColor (13) times to fill the
table.
LOGARITHMIC scaling finds the multiplicative factor such that:
NColor
VMax = VMin * X
This will divide the range VMin to VMax into NColor sections, each of which
is X times larger than the previous. X can be found by:
(1 / NColor)
X = (VMax/VMin)
The EXPONENTIAL scaling uses the logarithmic routine to first build the
color table for the logarithmic scaling. Then it flips the table around
end-for-end, and top-to-bottom. This changes the up-and-over logarithmic
curve to the over-and-up exponential curve.
HISTOGRAM scaling produces an equal-area scaling, where the range VMin to
VMax is divided into NColor sections, each of which has the same number
of image points within it. To do this, a histogram is made from the image
data. The histogram is a table that represents how many data points occur
for each data value, over all the data values (from VMin to VMax), i.e. how
many data elements are at a certain height for all heights. (Typically, the
histogram looks like the infamous "bell-shaped" curve used by school teachers
to place exam grades "on the curve". This is that curve.) Next, the histogram
is summed along its values - changing the bell-curve into an stretched out
S-curve: